package com.umakr.ax.app.web;

import com.umakr.ax.common.service.FavoriteService;
import com.umakr.ax.common.service.RadioStationShowService;
import com.umakr.ax.common.service.ShowFabulousService;
import com.umakr.ax.core.base.AbstractController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * <p>
 * ${table.comment}  前端控制器
 * </p>
 *
 * @author Wmdz
 * @since 2018-01-02
 */
@Controller
@RequestMapping("/api/radioStationShow")
public class RadioStationShowAppController extends AbstractController {

	@Autowired
	RadioStationShowService radioStationShowService;
	@Autowired
	ShowFabulousService showFabulousService;
	@Autowired
	FavoriteService favoriteService;

    @ApiOperation(value = "读取电台发布的信息详情")
    @GetMapping(value = "/detail")
    public Object detail(ModelMap modelMap,
						@RequestParam(name="userId", required = false) Long userId,
						@RequestParam(name="id") Long id) {
        return setSuccessModelMap(modelMap, radioStationShowService.detail(userId, id));
    }

	@ApiOperation(value = "读取 所有电台/关注电台 发布的信息 分页展示")
	@GetMapping("/load")
	@ResponseBody
	public Object load(ModelMap modelMap, String cityCode,@RequestParam(name = "type") Integer type,Long userId) {
		return setSuccessModelMap(modelMap,radioStationShowService.load(cityCode,type,userId));
	}

}